package UI;

import static UI.Constants.*;


import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;


public class TextAreaPanel extends JPanel{

	public TextAreaPanel(int whichArea, String englishName, String chineseName, int language, Dimension textAreaDimension){
		//construct a text area
		textArea = new JTextArea();
		//put the text area in a scroll pane
		textArea.setLineWrap(false);
        textArea.setWrapStyleWord(true); 
		JScrollPane scrollPane = new JScrollPane(textArea);
		scrollPane.setPreferredSize(textAreaDimension);
		
		//set the look of components
        if(language == English){
        	setBorder(new TitledBorder(new EtchedBorder(),englishName));
        	textArea.setFont(Input_English_Font);
        }
        if(language == Chinese){
        	setBorder(new TitledBorder(new EtchedBorder(),chineseName));
        	textArea.setFont(Input_Chinese_Font);
        }

        add(scrollPane);

	}
	
	public TextAreaPanel(String englishName, Dimension textAreaDimension){
		//construct a text area
		textArea = new JTextArea();
		
		//put the text area in a scroll pane
		textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);       
		JScrollPane scrollPane = new JScrollPane(textArea);
		scrollPane.setPreferredSize(textAreaDimension);

		//set the look of components

		setBorder(new TitledBorder(new EtchedBorder(),englishName));
        textArea.setFont(Input_English_Font);

        add(scrollPane);

	}
	
	public JLabel getLabel() {
		return label;
	}
	public void setLabel(JLabel label) {
		this.label = label;
	}
	public JTextArea getTextArea() {
		return textArea;
	}
	public void setTextArea(JTextArea textArea) {
		this.textArea = textArea;
	}
	
	private JLabel label;
	private JTextArea textArea;
 
	
}
